package com.example.service;

import com.example.dao.BuyChanceDao;
import com.example.dao.impl.BuyChanceDaoImpl;
import com.example.entity.customerAdmin.BuyChance;
import com.example.utils.ResultData;
import lombok.Data;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Data
@Service
public class BuyChanceService {
    @Resource
    private BuyChanceDao buyChanceDao;
    public ResultData selectAll(int page, int limit) {
        ResultData resultData=new ResultData();
        int newPage=(page-1)*limit;
        List<BuyChance> buyChances = buyChanceDao.selectAll(newPage, limit);
        resultData.setCode(0);
        resultData.setCount(buyChanceDao.getCount());
        resultData.setData(buyChances);
        return resultData;
    }
}
